package com.java.dormitorymanager.service.impl;

import com.java.dormitorymanager.dao.IManagerDao;
import com.java.dormitorymanager.impl.ManagerDaoImpl;
import com.java.dormitorymanager.pojo.Manager;
import com.java.dormitorymanager.service.IManagerService;
import com.java.dormitorymanager.util.BasicDao;

import java.util.List;

/**
 * @program: DormitoryManager
 * @description: IManagerService的实现类
 * @author: ShuangChenYue
 * @create: 2021-05-14 15:47
 **/
public class ManagerServiceImpl implements IManagerService
{
    IManagerDao managerDao = new ManagerDaoImpl();
//=====================================================用户登陆==========================================================
    @Override
    public Manager login(String name, String password)
    {
        return managerDao.findByNameAndPassword(name, password);
    }

    @Override
    public void register(Manager manager)
    {
        managerDao.addManager(manager);
    }

    @Override
    public List<Manager> findAll()
    {
        return managerDao.findAll();
    }

    @Override
    public List<Manager> findAllSuperManager()
    {
        return managerDao.findAllSuperManager();
    }

    @Override
    public Manager findById(int id)
    {
        return managerDao.findManagerById(id);
    }

    @Override
    public void updateSuperManager(Manager manager)
    {
        managerDao.updateSuperManager(manager);
    }

    @Override
    public List<Manager> findAllCommonManager()
    {
        return managerDao.findAllCommonManager();
    }

    @Override
    public void deleteCommonManagerById(int id)
    {
        managerDao.deleteCommonManagerById(id);
    }

    @Override
    public void updateCommonManager(Manager manager)
    {
        managerDao.updateCommonManager(manager);
    }

    @Override
    public void addCommonManager(Manager manager)
    {
        managerDao.addCommonManager(manager);
    }

    @Override
    public Manager findCommonManagerByName(String name)
    {
        return managerDao.findCommonManagerByName(name);
    }

    @Override
    public void updateCommonManagerStatusToZero(int id)
    {
        managerDao.updateCommonManagerStatusToZero(id);
    }

    @Override
    public List<Manager> findAllBannedManager()
    {
        return managerDao.findAllBannedManager();
    }

    @Override
    public void deleteBannedManagerById(int id)
    {
        managerDao.deleteBannedManagerById(id);
    }

    @Override
    public void openBannedManagerById(int id)
    {
        managerDao.openBannedManagerById(id);
    }

    @Override
    public List<Manager> findAllDormManager()
    {
        return managerDao.findAllCommonManager();
    }
}
